<?php
/**
 * @file database.php
 * 数据库连接配置
 */

class DbCon{
    private $db_host = '1h7qbvfn.2370.dnstoo.com';
    private $db_type = 'mysql';
    private $db_user = 'wangjibu_f';
    private $db_pass = 'wangjibu';
    private $db_name = 'wangjibu';
    private $pdo;
    //关于数据库的链接
    public function __construct() {
        $dsn = "mysql:host=" . $this->db_host. ";dbname=" . $this->db_name . ";charset=utf8";
        $db_user = $this->db_user;
        $db_pass = $this->db_pass;
        $this->pdo = new PDO($dsn, $db_user, $db_pass);
    }
    //对于数据库的相关操作
    //增加user用户的数据的写入
 
    //删除
    public function delete($sql) {
        return $this->pdo->exec($sql);
    }
    //修改
    public function modify($sql) {
        return $this->pdo->exec($sql);
    }
    //查询
    public function query($sql) {
        $pdoStatement = $this->pdo->query($sql, PDO::FETCH_ASSOC);
        $data = $pdoStatement->fetchAll();
        return $data;
    }
     //对于成员信息的操作
    //对于成员事件的添加
    public function add($sql){
            $this->pdo->exec($sql);
            return $this->pdo->lastInsertId();
    }



}




